@extends("admin.frame_layout")
<?php $top_selected = "会员管理";$page_menu = "会员信息采集" ?>
@section('content')
    <div class="rightinfo">
        <div class="tools">
            <ul class="toolbar">
                <li>
                    <a href="{{route('admin.user_info.edit')}}">
                        <span><img src="{{asset('admin/imgs/t01.png')}}"/></span>添加会员属性
                    </a>
                </li>
            </ul>
        </div>

        <table class="tablelist">
            <thead>
            <tr>
                <th width="70px">操作</th>
                <th>名称</th>
                <th>标识</th>
                <th>属性权限</th>
                <th width="80px">状态</th>
            </tr>
            </thead>
            <tbody>

            @foreach($attrs as $attr)
                <tr>
                    <td class="act" bind="#{{$attr->id}}">
                        <img src="{{asset('admin/imgs/t05.png')}}"/>菜单
                        <ul id="{{$attr->id}}">
                            <li>
                                <a href="{{route('admin.user_info.edit',['id'=>$attr->id])}}">
                                    <img src="{{asset('admin/imgs/d02.png')}}"/>编辑属性
                                </a>
                            </li>
                            @if($attr->enable == 1)
                            <li onclick="openOkDlg('{{route('admin.user_info.off',['id'=>$attr->id])}}')">
                                <img src="{{asset('admin/imgs/d02.png')}}"/>关闭属性
                            </li>
                            @endif
                            @if($attr->enable == 0)
                                <li onclick="openOkDlg('{{route('admin.user_info.on',['id'=>$attr->id])}}')">
                                    <img src="{{asset('admin/imgs/d02.png')}}"/>开启属性
                                </li>
                            @endif
                            @if(ss('admin_super') == 1)
                                <li onclick="openOkDlg('{{route('admin.user_info.del',['id'=>$attr->id])}}')">
                                    <img src="{{asset('admin/imgs/d02.png')}}"/>删除属性
                                </li>
                            @endif
                        </ul>
                    </td>
                    <td>{{isset($attr->name)?$attr->name:''}}</td>
                    <td>{{isset($attr->mark)?$attr->mark:''}}</td>
                    <?php $flag = \App\Models\MUserAttr::getUnArray($attr->flag) ?>
                    <td class="text-left">
                      @foreach($flag as $k=>$v)
                          @if($k == \App\Models\MUserAttr::$REGISTER_ATTR)
                              注册--
                          @elseif($k == \App\Models\MUserAttr::$WITHDRAW_ATTR)
                              提现--
                          @elseif($k == \App\Models\MUserAttr::$TRANSFER_ATTR)
                              转账--
                          @elseif($k == \App\Models\MUserAttr::$ACCEPT_ADDR_ATTR)
                              收货地址--
                          @endif

                          @if($v == 0)
                              关&nbsp;&nbsp;&nbsp;&nbsp;
                          @elseif($v == 1)
                              开&nbsp;&nbsp;&nbsp;&nbsp;
                          @endif
                      @endforeach
                    </td>

                    <td>
                        @if($attr->enable == \App\Models\MUserAttr::$USER_ATTR_OFF)
                            关闭
                        @elseif($attr->enable == \App\Models\MUserAttr::$USER_ATTR_ON)
                            开启
                        @endif
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>
    </div>

    @include('admin.coms.dialog')
@endsection
@section('footer')
    <script type="text/javascript">
        $(document).ready(function () {
            //初始化表格操作菜单
            $('.tablelist tbody tr:odd').addClass('odd');
            $(".tablelist .act").hover(function () {
                $($(this).attr("bind")).show();
            }, function () {
                $($(this).attr("bind")).hide();
            });
        });
    </script>
@endsection

